package com.tianji.promotion.annotations;

import com.tianji.promotion.enums.MyLockStrategy;
import com.tianji.promotion.enums.MyLockType;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.concurrent.TimeUnit;

@Retention(RetentionPolicy.RUNTIME)// 表示在运行时保留注解
@Target(ElementType.METHOD)// 表示该注解只能用于方法上
public @interface MyLock {
    String name();
    long waitTime() default 1;
    long leaseTime() default -1;

    TimeUnit timeUnit() default TimeUnit.SECONDS;

    MyLockType lockType() default MyLockType.RE_ENTRANT_LOCK;

    MyLockStrategy strategy() default MyLockStrategy.FAIL_AFTER_RETRY_TIMEOUT;
}
